<?php

require_once "obj.mysql.mex";

function CONN($Var) {

	global $__DBHOST;
	global $__DBT;
	global $__DBD;
	global $__DBUSER;
	global $__DBPASS;

	// MYI || DATA - PROCEDURE MODE
	// MYT || DATA - QUERY MODE
	// MYD || SYST - QUERY MODE
	if ($Var == 'MYI') {
		$GLOBALS['MYI'] = new mysqli($__DBHOST, $__DBUSER, $__DBPASS, $__DBT);
		// check connection
		if (!$GLOBALS['MYI']->set_charset("utf8")) {
			printf("Error loading character set utf8: %s\n", $mysqli->error);
		}
		if (mysqli_connect_errno ()) {
			printf("<br />Connect failed: %s\n", mysqli_connect_error());
			exit();
		}
	} elseif ($Var == 'MYT') {
		$MDB = new SqlClass($__DBHOST, $__DBUSER, $__DBPASS, $__DBT);
	} elseif ($Var == 'MYD') {
		$MDB = new SqlClass($__DBHOST, $__DBUSER, $__DBPASS, $__DBD);
	} elseif ($Var == 'MYS') {
		$MDB = new SqlClass($__DBHOST, $__DBUSER, $__DBPASS, $__DBS);
	}
}

function MYTCONN() {

	global $__DBHOST;
	global $__DBT;
	global $__DBUSER;
	global $__DBPASS;

	$GLOBALS['MYT'] = new SqlClass($__DBHOST, $__DBUSER, $__DBPASS, $__DBT);
}

function MYDCONN() {

	global $__DBHOST;
	global $__DBD;
	global $__DBUSER;
	global $__DBPASS;

	$GLOBALS['MYD'] = new SqlClass($__DBHOST, $__DBUSER, $__DBPASS, $__DBD);
}

function WEBCONN() {

	global $__DBHOSTWEB;
	global $__DBW;
	global $__DBUSERWEB;
	global $__DBPASSWEB;

	$GLOBALS['WEB'] = new SqlClass($__DBHOSTWEB, $__DBUSERWEB, $__DBPASSWEB, $__DBW);
}